package ink.metoo.auto.fishpi.call

import ink.metoo.auto.fishpi.ClientCaches

object BreezeMoonCall {

    class AddBreezeMoonBody : AbstractBaseBody() {
        var breezemoonContent: String = ""
    }

    class AddBreezeMoonResult : AbstractBaseResult() {

        var data: AddBreezeMoonResultData? = null

    }

    class AddBreezeMoonResultData {
        var breezemoonAuthorName: String? = null
        var breezemoonAuthorThumbnailURL48: String? = null
        var breezemoonContent: String? = null
        var oId: String? = null
    }

    fun addBreezeMoon(breezemoonContent: String) = Requests.sendJsonRequest<AddBreezeMoonResult>(
        path = "/breezemoon",
        body = AddBreezeMoonBody().fillFormCache {
            it.breezemoonContent = breezemoonContent
        }
    )

    fun deleteBreezeMoon(oId: String) = Requests.sendJsonRequest<BaseResult>(
        path = "/breezemoon/${oId}",
        queryParams = arrayOf(
            "apiKey" to ClientCaches.apiKey,
        ),
        method = "DELETE"
    ) {
        header("csrfToken", CsrfCall.getCsrfToken() ?: "")
    }

}